clear; clc; close all;
% 绘制 MNFM1 映射下 (x, y) 迭代后的吸引子

% 参数设置
a = 0.02;
b = 2.6;
c = 1.1;
d = 0.001;

N = 50000;         % 迭代步数
discard = 100;    % 丢弃暂态步数

% 两组初始条件
IC1 = [-1, -2];   % (x(0), y(0)) = (-1, -2) -> 用红色绘制
IC2 = [ 1,  2];   % (x(0), y(0)) = ( 1,  2) -> 用黑色绘制

% 分配存储空间
x1 = zeros(N,1);  y1 = zeros(N,1);
x2 = zeros(N,1);  y2 = zeros(N,1);

% 初始化并迭代 (IC1)
x1(1) = IC1(1);
y1(1) = IC1(2);
for k = 1 : N-1
    [x1(k+1), y1(k+1)] = f1(x1(k), y1(k), a, b, c, d);
end

% 初始化并迭代 (IC2)
x2(1) = IC2(1);
y2(1) = IC2(2);
for k = 1 : N-1
    [x2(k+1), y2(k+1)] = f1(x2(k), y2(k), a, b, c, d);
end

figure('Color','w');
% 丢弃前 discard 步，绘制红色轨迹
plot(x1(discard+1:end), y1(discard+1:end), '.', 'Color','r', 'MarkerSize',3); 
hold on;
% 绘制黑色轨迹
plot(x2(discard+1:end), y2(discard+1:end), '.', 'Color','b', 'MarkerSize',3);

xlabel('x'); ylabel('y');
title('Coexisting Chaos for MNFM1');
legend({'(-1, -2) in Red','(1, 2) in Black'}, 'Location','best');
grid on; box on; axis tight;
